Command ‘python‘ not found, did you mean: command ‘python3‘ from deb python3

您所在的位置:网站首页 python 38 installer Command ‘python‘ not found, did you mean: command ‘python3‘ from deb python3

Command ‘python‘ not found, did you mean: command ‘python3‘ from deb python3

#Command ‘python‘ not found, did you mean: command ‘python3‘ from deb python3| 来源: 网络整理| 查看: 265

如果在Ubuntu中已经安装python3,但是执行的时候,会出现如下错误:

yww@yww:~/test$ python test.py Command 'python' not found, did you mean: command 'python3' from deb python3 command 'python' from deb python-is-python3

如果不确定是否安装python,可以通过在终端中输入以下命令

python3 --version

查看是否安装,如果没有安装python,需要通过如下命令安装python

sudo apt install python3

如果确定已经安装python,有两种方法可以运行py文件

通过python3运行

python3 test.py

将python命令映射到python,需要安装软件包`python-is-python3`:

sudo apt install python-is-python3

安装过程如下:

yww@yww:~/test$ sudo apt install python-is-python3 Reading package lists... Done Building dependency tree... Done Reading state information... Done The following NEW packages will be installed: python-is-python3 0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded. Need to get 2,788 B of archives. After this operation, 13.3 kB of additional disk space will be used. Get:1 https://mirror.nju.edu.cn/ubuntu jammy/main amd64 python-is-python3 all 3.9.2-2 [2,788 B] Fetched 2,788 B in 11s (264 B/s) Selecting previously unselected package python-is-python3. (Reading database ... 220473 files and directories currently installed.) Preparing to unpack .../python-is-python3_3.9.2-2_all.deb ... Unpacking python-is-python3 (3.9.2-2) ... Setting up python-is-python3 (3.9.2-2) ... Processing triggers for man-db (2.10.2-1) ... yww@yww:~/test$ python test.py hello yww hello world


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3